//
//  SubItemsViewController.m
//  礼物go
//
//  Created by dllo on 16/5/27.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "SubItemsViewController.h"

@interface SubItemsViewController ()

@end

@implementation SubItemsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = self.naviTitle;
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"Arial" size:20],NSForegroundColorAttributeName:[UIColor whiteColor]}];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"<返回" style:UIBarButtonItemStylePlain target:self action:@selector(leftButtonAction)];
    [self.navigationItem.leftBarButtonItem setTintColor:[UIColor whiteColor]];
    
    //self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"order"] style:UIBarButtonItemStylePlain target:self action:@selector(rightButtonAction)];
    [self.navigationItem.rightBarButtonItem setTintColor:[UIColor whiteColor]];
    
    
    
    

    
    
    
    
    // Do any additional setup after loading the view.
}

-(void)getSelectList:(NSUInteger)nextCursor{
    AFNetworkReachabilityManager *netManager = [AFNetworkReachabilityManager sharedManager];
    NSString *urlStr = [NSString stringWithFormat:@"http://api.liwushuo.com/v2/item_subcategories/%@/items?limit=20&offset=%ld",self.dataId,20 * nextCursor];
    [LYNetworking ly_GetWithURL:urlStr Parameter:nil success:^(id result) {
        [netManager stopMonitoring];
        if (self.isUpLoading == NO) {
            //说明是下拉，就要清空数组中的数据
            [self.dataArray removeAllObjects];
        }
        NSDictionary *dataDic = [result objectForKey:@"data"];
        NSArray *itemArray = [dataDic objectForKey:@"items"];
        for (NSDictionary *dic in itemArray) {
            HotColumnModel *hotModel = [[HotColumnModel alloc] init];
            [hotModel setValuesForKeysWithDictionary:dic];
            [self.dataArray addObject:hotModel];
        }
        [self.hotCollectionView.mj_header endRefreshing];
        [self.hotCollectionView.mj_footer endRefreshing];
        [self.hotCollectionView reloadData];
    } error:^(NSError *error) {
        
        
    }];

}


-(void)leftButtonAction{
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
